﻿using System;

namespace ConsoleDemo
{
    public class AnonymousClassDemo
    {
        public delegate void DelegateTest(string testName);

        public static void PrintAnnoyClaDemo()
        {
            //var annoyCla1 = new
            //{
            //    ID = 10010,
            //    Name = "EdisonChou",
            //    Age = 25
            //};
            //Console.WriteLine("ID:{0}-Name:{1}-Age:{2}", annoyCla1.ID, annoyCla1.Name, annoyCla1.Age);

            //// 02.属性类型和顺序与annoyCla1一致，那么共同使用一个匿名类
            //var annoyCla2 = new
            //{
            //    ID = 10086,
            //    Name = "WncudChou",
            //    Age = 25
            //};
            //Console.WriteLine("ID:{0}-Name:{1}-Age:{2}", annoyCla1.ID,
            //    annoyCla1.Name, annoyCla1.Age);
            //Console.WriteLine("Is The Same Class of 1 and 2:{0}",
            //    annoyCla1.GetType() == annoyCla2.GetType());

            //var annoyCla3 = new
            //{
            //    ID = "EdisonChou",
            //    Name = 10010,
            //    Age = 25
            //};
            //Console.WriteLine("ID:{0}-Name:{1}-Age:{2}", annoyCla3.ID,
            //    annoyCla3.Name, annoyCla3.Age);
            //Console.WriteLine("Is The Same Class of 2 and 3:{0}",
            //    annoyCla3.GetType() == annoyCla2.GetType());

            //var annoyCla4 = new
            //{
            //    Name = "EdisonChou",
            //    ID = 10010,
            //    Age = 25
            //};
            //Console.WriteLine("ID:{0}-Name:{1}-Age:{2}", annoyCla4.ID,
            //    annoyCla4.Name, annoyCla4.Age);
            //Console.WriteLine("Is The Same Class of 2 and 4:{0}",
            //    annoyCla4.GetType() == annoyCla2.GetType());
        }

        DelegateTest dgTest2 = new DelegateTest(delegate (string name)
        {
            Console.WriteLine("Good,{0}", name);
        });
    }
}
